package day05;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 说明:
 *
 * @author: luohaowei
 * @date:2023/2/16
 **/
public class zy {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int score=0;
        for(int i=1;i<=10;i++){
            int a=(int)(Math.random()*100);
            int b=(int)(Math.random()*100);
            int result=a+b;
            System.out.println("("+i+")"+a+"+"+b+"=?");
            System.out.println("算吧");
            int answer= scan.nextInt();
            if(answer==result){
                System.out.println("答对了");
                score+=10;
            }else{
                System.out.println("打错了");
            }
        }
        System.out.println("总分为:"+score);
        /*
         int score=0;
        for(int i=1;i<=10;i++){
            int a=(int)(Math.random()*100);
            int b=(int)(Math.random()*100);
            int result=a+b;
            System.out.println("("+i+")"+a+"+"+b+"=?");
            System.out.println("算吧");
            int answer= scan.nextInt();
            if(answer==result){
                System.out.println("答对了");
                score+=10;
            }else{
                System.out.println("打错了");
            }
        }
        System.out.println("总分为:"+score);
         */
        for(int num=1;num<=9;num++) {
            for (int i = 1; i <= num; i++) {
                System.out.print(i + "*" + num + "=" + i * num + "\t");
            }
            System.out.println();
        }
        /*
        for(int num=1;num<=10;num++) {
            for (int i = 1; i <= num; i++) {
                System.out.print(i + "*" + num + "=" + i * num + "\t");
            }
            System.out.println();
        }
         */
        int[] a=new int[5];
        double[] d=new double[10];
        boolean[] c=new boolean[26];
        int [] arr1=new int[3];
        int []arr2={2,5,8};
        int []arr3=new  int[]{2,5,8};
        int[]arr4;
        arr4=new int[]{2,5,8};
        /*
         int[] a=new int[5];
       double[] d=new double[10];
       boolean[] c=new boolean[26];
        int [] arr1=new int[3];
        int []arr2={2,5,8};
        int []arr3=new  int[]{2,5,8};
        int[]arr4;
        arr4=new int[]{2,5,8};
         */
        int[]arr=new int[3];
        System.out.println("数组的长度:"+arr.length);
        System.out.println(arr[0]);//0,输出第一个元素的值
        arr[0]=100;//给第一个元素赋值围100
        arr[1]=200;//给第二个元素赋值为200
        arr[2]=300;//给第三个元素赋值为300
        System.out.println(arr[arr.length-1]);
        /*
        int[]arr=new int[3];
        System.out.println("数组的长度:"+arr.length);
        System.out.println(arr[0]);//0,输出第一个元素的值
        arr[0]=100;//给第一个元素赋值围100
        arr[1]=200;//给第二个元素赋值为200
        arr[2]=300;//给第三个元素赋值为300
        System.out.println(arr[arr.length-1]);
         */
        int[] arrm=new int[10];
        for(int i=0;i<arr.length;i++) {
            arr[i] = (int) (Math.random() * 100);
            System.out.println(arr[i]);
        }
        /*
        int[] arrm=new int[10];
        for(int i=0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*100);
            System.out.println(arr[i]);
            }
         */
        int[] arro=new int[10];
        for(int i=0;i<arro.length;i++) {
            arro[i] = (int)(Math.random()*100);
            System.out.println(arro[i]);
        }
        Arrays.sort(arro);
        System.out.println("排序后");
        for(int i=0;i<arro.length;i++){
            System.out.println(arro[i]);
        }
        System.out.println("倒着输出:");
        for(int i=arro.length-1;i>=0;i--){
            System.out.println(arro[i]);
        }
        System.out.println("第一个元素为"+arro[0]);
        /*
        int[] arro=new int[10];
        for(int i=0;i<arro.length;i++) {
            arro[i] = (int)(Math.random()*100);
            System.out.println(arro[i]);
        }
        Arrays.sort(arro);
        System.out.println("排序后");
        for(int i=0;i<arro.length;i++){
            System.out.println(arro[i]);
        }
        System.out.println("倒着输出:");
        for(int i=arro.length-1;i>=0;i--){
            System.out.println(arro[i]);
        }
        System.out.println("第一个元素为"+arro[0]);
         */
    }
}
